//
//  CheckDetailInfoVC.m
//  掌上宏力
//
//  Created by admin on 2017/5/15.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "CheckDetailInfoVC.h"
#import "CheckInfoModel.h"
#import "CheckResultModel.h"
#import "CheckDetailViewModel.h"

@interface CheckDetailInfoVC ()

@property (nonatomic,strong) CheckResultModel *checkResult;

@property (nonatomic,strong) UILabel *descLab;
@property (nonatomic,strong) UILabel *impressLab;
@end

@implementation CheckDetailInfoVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"检查结果";
    [SVProgressHUD showWithStatus:@"正在加载中..."];
    [self getCheckResultInfo];
    [self createResultView];
}
-(void)getCheckResultInfo{
    CheckDetailViewModel *viewModel = [[CheckDetailViewModel alloc] init];
    viewModel.infoModel = self.infoModel;
    [viewModel getCheckDetailInfo:^(CheckResultModel *result) {
        _checkResult = result;
        [self setResultView];
//        [SVProgressHUD dismiss];
    }];
}
-(void)setResultView{
    CGFloat pad = 50;
    CGSize descSize = [Factory sizeWithText:_checkResult.desc font:kFont(15) maxSize:CGSizeMake(kScreenW-LeftDis*2, MAXFLOAT)];
    self.descLab.frame = CGRectMake(LeftDis, -10, kScreenW-LeftDis*2, descSize.height+pad);
    self.descLab.text = [NSString stringWithFormat:@"%@",_checkResult.desc];
    CGSize impressSize = [Factory sizeWithText:_checkResult.impression font:kFont(15) maxSize:CGSizeMake(kScreenW-LeftDis*2, MAXFLOAT)];
    
    self.impressLab.frame = CGRectMake(LeftDis, self.descLab.bottom, kScreenW-LeftDis*2, impressSize.height+pad);
     self.impressLab.text = [NSString stringWithFormat:@"%@",_checkResult.impression];
    
    UIView *line = [Factory createViewWithBackgroundColor:[UIColor lightGrayColor] frame:CGRectMake(LeftDis, self.descLab.bottom+15, kScreenW-LeftDis*2, 1) ];
    [self.view addSubview:line];
    [SVProgressHUD dismiss];
}
-(void)createResultView{
    
    UILabel *descLab = [[UILabel alloc] init];
    descLab.numberOfLines = 0;
    [self.view addSubview:descLab];
    self.descLab = descLab;
    
    UILabel *impressLab = [[UILabel alloc] init];
    impressLab.numberOfLines = 0;
    [self.view addSubview:impressLab];
    self.impressLab = impressLab;
}


@end
